package py.com.alfa.escriba.gui.controller.object.gestion;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.ApplicationContext;

import py.com.alfa.escriba.gui.config.EscribaGUIApplicationContextProvider;
import py.com.alfa.escriba.gui.controller.view.Permissions;
import py.com.alfa.escriba.gui.controller.view.View;
import py.com.alfa.escriba.gui.controller.view.ViewManager;
import py.com.alfa.escriba.gui.controller.view.gestion.VehiculosViewContext;
import py.com.alfa.escriba.gui.controller.view.gestion.VehiculosViewFragment;
import py.com.alfa.escriba.gui.dto.admin.PaisDTO;
import py.com.alfa.escriba.gui.dto.admin.TabRefDTO;
import py.com.alfa.escriba.gui.dto.gestion.DatoscomplementariosDTO;
import py.com.alfa.escriba.gui.dto.gestion.MonedasDTO;
import py.com.alfa.escriba.gui.dto.gestion.TemplatesDTO;
import py.com.alfa.escriba.gui.dto.gestion.VehiculosDTO;
import py.com.alfa.escriba.gui.dto.gestion.VehiculosinfoDTO;
import py.com.alfa.escriba.gui.services.Services;



public class VehiculosControllerObject {
	
	private List<VehiculosDTO> vehiculos;
	private VehiculosDTO filtros;
	private VehiculosDTO vehiculo;
	private VehiculosDTO vehiculoOri;
	private VehiculosinfoDTO vehiculoInfo;
	private List<TemplatesDTO> templates;
	private List<DatoscomplementariosDTO> datosComplementarios;
	private List<PaisDTO> paises;
	private List<MonedasDTO> monedas;
	private List<TabRefDTO> usos;
	private List<TabRefDTO> estados;
	private List<TabRefDTO> valores;
	
	private ViewManager viewManager;
	private String titulo = "";
	
	public VehiculosControllerObject() {
		ApplicationContext ctx = EscribaGUIApplicationContextProvider.getContext();
		this.setViewManager((ViewManager) ctx.getBean(Services.VIEW_MANAGER));
		this.getViewManager().registerContext(View.VEHICULOS, new VehiculosViewContext());
		this.setVehiculos(new ArrayList<VehiculosDTO>());
		this.setVehiculo(null);
	}

	public VehiculosViewFragment view(){
		return (VehiculosViewFragment) this.getContext().getViewFragment();
	}

	public VehiculosViewContext getContext(){
		return (VehiculosViewContext) getViewManager().getContext(View.VEHICULOS);
	}
	
	public Permissions getPermissions(){
		return getViewManager().getPermissions();
	}
	
	public ViewManager getViewManager() {
		return viewManager;
	}

	public void setViewManager(ViewManager viewManager) {
		this.viewManager = viewManager;
	}

	public String getTitulo() {
		return titulo;
	}

	public void setTitulo(String titulo) {
		this.titulo = titulo;
	}
	
	public String descEstado(boolean activo) {
		return (activo)?"SI":"NO";
	}

	public List<VehiculosDTO> getVehiculos() {
		return vehiculos;
	}

	public void setVehiculos(List<VehiculosDTO> vehiculos) {
		this.vehiculos = vehiculos;
	}

	public VehiculosDTO getVehiculo() {
		if ( this.vehiculo == null) {
			this.vehiculo = new VehiculosDTO();
		}
		return vehiculo;
	}

	public void setVehiculo(VehiculosDTO vehiculo) {
		this.vehiculo = vehiculo;
	}

	public VehiculosDTO getFiltros() {
		return filtros;
	}

	public void setFiltros(VehiculosDTO filtros) {
		this.filtros = filtros;
	}

	public VehiculosinfoDTO getVehiculoInfo() {
		return vehiculoInfo;
	}

	public void setVehiculoInfo(VehiculosinfoDTO vehiculoInfo) {
		this.vehiculoInfo = vehiculoInfo;
	}

	public List<TemplatesDTO> getTemplates() {
		return templates;
	}

	public void setTemplates(List<TemplatesDTO> templates) {
		this.templates = templates;
	}

	public List<DatoscomplementariosDTO> getDatosComplementarios() {
		return datosComplementarios;
	}

	public void setDatosComplementarios(
			List<DatoscomplementariosDTO> datosComplementarios) {
		this.datosComplementarios = datosComplementarios;
	}

	public List<PaisDTO> getPaises() {
		return paises;
	}

	public void setPaises(List<PaisDTO> paises) {
		this.paises = paises;
	}

	public List<MonedasDTO> getMonedas() {
		return monedas;
	}

	public void setMonedas(List<MonedasDTO> monedas) {
		this.monedas = monedas;
	}

	public List<TabRefDTO> getUsos() {
		return usos;
	}

	public void setUsos(List<TabRefDTO> usos) {
		this.usos = usos;
	}

	public List<TabRefDTO> getEstados() {
		return estados;
	}

	public void setEstados(List<TabRefDTO> estados) {
		this.estados = estados;
	}

	public VehiculosDTO getVehiculoOri() {
		return vehiculoOri;
	}

	public void setVehiculoOri(VehiculosDTO vehiculoOri) {
		this.vehiculoOri = vehiculoOri;
	}

	public List<TabRefDTO> getValores() {
		return valores;
	}

	public void setValores(List<TabRefDTO> valores) {
		this.valores = valores;
	}
		
}
